<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./lib/vue.min.js"></script>
    <link rel="stylesheet" href="./lib/animate.min.css">
</head>
<body>      
    <div id="app">
    <!-- 需求： 点击按钮让h3显示，在点击按钮让h3隐藏 -->
    <input type="button" value="点击" @click = "toggle">
    
    <!-- animate.css官网提供动画库支持 -->
    <!-- 入场：bounceIn  出场: bounceOut 注意要实现入场和出场，必须在前面加上animated -->
    <!-- <transition enter-active-class = "animated bounceIn" leave-active-class = "animated bounceOut">
        <h3 v-if = "flag">你是风儿，我是沙</h3>
    </transition> -->
    
    <!-- 上面这种简写方式 :duration = "400" 表示统一设置入场和出场需要花费的时间 -->
    <!-- <transition enter-active-class = "bounceIn" leave-active-class = "bounceOut" :duration = "400">
        <h3 v-if = "flag" class="animated">你是风儿，我是沙</h3>
    </transition> -->
    
    <!-- 进场时间200毫秒， 出场时间300毫秒，分开设置 -->
    <transition enter-active-class = "bounceIn" leave-active-class = "bounceOut" :duration = "{enter:200, leave:400}">
        <h3 v-if = "flag" class="animated">你是风儿，我是沙</h3>
    </transition>

    </div>
    
    <script>
        var vm = new Vue({
            el:"#app",
            data:{
                flag : true
            },
            methods: {
                toggle() {
                    this.flag = !this.flag
                }
            }
        })
    </script>
</body>
</html>